<template>
  <div class="all">
      <div class="top">
        <div class="back">
            <div class="top_left">
                <div class="apple_back">
                    <img class="apple" src="../../assets/adver_space/samllapple.png"/>
                </div>
                <div class="message">
                    <h2 class="message1">品牌：</h2>
                    <h2 class="message2">{{AdverMessage.aname}}</h2>
                    <span class="message3">已在本网站成交</span>
                    <h3 class="message4">56笔</h3>
                    <span class="message5">广告</span>
                    <div><span class="message6">电话号码：{{AdverMessage.aphone}}</span></div>
                    <span class="message7">电子邮箱：{{AdverMessage.aemail}}</span>
                </div>
            </div>
            <div class="top_right">
                <img src="../../assets/adver_space/apple.png"/>
            </div>
        </div>
        <div class="bottom">
                <el-card @click="push(index+1)" class="card1" v-for="(item,index) in product" :key="index">
                    <img @click="push(index+1)" class="iphone13" src="../../assets/product/diannao.jpg"/>
                    <div @click="push(index+1)" class="iphone_meassage">
                        <a class="iphone_meassage2">{{item.pname}}</a>
                        <a class="iphone_meassage1">{{item.preleasetime}}</a>
                    </div>
                </el-card>
                <!-- <el-card @click="push()" class="card2">
                    <img  @click="push()" class="iphone13" src="../../assets/producer_trade/iphone13.png"/>
                    <div @click="push()" class="iphone_meassage">
                        <a class="iphone_meassage2">iPhone13 pro</a>
                        <a class="iphone_meassage1">2021/12/30</a>
                    </div>
                </el-card> -->
        </div>
      </div>
     
  </div>
</template>

<script>
export default {
    name:'adver_detail',
    data() {
        return {
             product:[],
            AdverMessage:{},
        }
    },
     methods:{
      push(pid){
          window.sessionStorage.setItem("pid",pid)
         this.$router.push({path:'/product'})
      },
        //product接口开始
        init(){
            //获取上个界面存储的ID
            var rams=JSON.parse(sessionStorage.getItem("aid"));
            // console.log(sessionStorage.getItem("vid"));
            console.log(rams);
            console.log(typeof(rams));
            console.log(rams=="1");
            console.log(typeof("1"))
            var rams2=Number(rams);
            console.log(rams2);
            // var params1=qs.stringify(sessionStorage.getItem("vid"));
            // console.log(params1);
            this.$axios({
               method:'post',
               url:'http://1.117.65.58:9001/product/findallbyaid',
               params:{"aid":rams2},
            //    headers: {'Content-Type': '1.117.65.58application/json; charset=utf-8'},
            }).then(response=>{
            console.log(response);
            const arr =response.data.data;
            this.product=arr;
            console.log(this.product)
            // window.sessionStorage.setItem('userInfo',JSON.stringify(arr));
           }).catch(function(err){
               console.log(err)
           })
        },
        //product接口结束
       //广告商的信息接口
          Adverinit(){
            //获取上个界面存储的ID
            var rams=JSON.parse(sessionStorage.getItem("aid"));
            // console.log(sessionStorage.getItem("vid"));
            console.log(rams);
            console.log(typeof(rams));
            console.log(rams=="1");
            console.log(typeof("1"))
            var rams2=Number(rams);
            console.log(rams2);
            // var params1=qs.stringify(sessionStorage.getItem("vid"));
            // console.log(params1);
            this.$axios({
               method:'post',
               url:'http://1.117.65.58:9001/advertiser/findbyaid',
               params:{"aid":rams2},
            //    headers: {'Content-Type': 'application/json; charset=utf-8'},
            }).then(response=>{
            console.log(response);
            console.log(9999)
            const arr =response.data.data;
            this.AdverMessage=arr;
            console.log(this.AdverMessage)
            // window.sessionStorage.setItem('userInfo',JSON.stringify(arr));
           }).catch(function(err){
               console.log(err)
           })
        },
        //广告商的信息接口结束

    },
    mounted(){
        this.init()
        this.Adverinit()
    }

}
</script>

<style scoped>
@import "../../style/adver_space.css";
@import "../../style/adver_detail.css";
</style>